
package com.forestar.mapControl.utils.mapConvert.geometry;

import com.forestar.mapControl.utils.mapConvert.geometry.coordinatesystem.CoordinateSystem;
import com.forestar.mapControl.utils.mapConvert.geometry.utils.GeometryUtils;
import com.mapzone.api.geometry.mzMultiPoint;
import com.mapzone.api.geometry.mzPoint;

public class GeoMultiPoint implements IGeometry {

    private CoordinateSystem coordSystem;
    private mzMultiPoint m_mzMultiPoint;

    public GeoMultiPoint(CoordinateSystem coordSystem, mzMultiPoint mulitPoint)
    {
        this.coordSystem = coordSystem;
        this.m_mzMultiPoint = mulitPoint;
    }

//    public GeoMultiPoint(CoordinateSystem coordSystem2, MultiPoint gm)
//    {
//    }

    public void setX(double dX)
    {

    }

    public void setY(double dY)
    {

    }

    public float getX()
    {
        return 0;
    }

    public float getY()
    {
        return 0;
    }

    @Override
    public GeometryType getGeometryType()
    {
        return GeometryType.GeometryTypeMultiPoint;
    }

    @Override
    public CoordinateSystem getCoordinateSystem()
    {
        return coordSystem;
    }


    @Override
    public Envelope getEnvelope()
    {
        return GeometryUtils.getEnvelope(m_mzMultiPoint);
    }

    @Override
    public void setCoordinateSystem(CoordinateSystem coordSystem)
    {
        // TODO Auto-generated method stub
        this.coordSystem = coordSystem;
    }

    @Override
    public  IGeometry Clone()
        {
            mzMultiPoint m_mzMultiPointClone = (mzMultiPoint) this.m_mzMultiPoint.clone();
            GeoMultiPoint geoMultiPoint = new GeoMultiPoint(this.coordSystem, m_mzMultiPointClone);
            return  geoMultiPoint;
        }

    @Override
    public byte[] getBlob()
        {
            return GeoConverter.Geom2Blob(this.m_mzMultiPoint);
        }

    @Override
    public Object getInternalObject() {
        return m_mzMultiPoint;
    }

    @Override
    public boolean isSimple()
        {
            return true;
        }

    public int getGeoPointCount()
        {
            return  m_mzMultiPoint.getPointCount();
        }

    public GeoPoint getGeoPoint(int nIndex)
        {
            mzPoint m_mzPoint = m_mzMultiPoint.GetPoint(nIndex);
            return  new GeoPoint(this.coordSystem,m_mzPoint);
        }

}
